<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/jsp/common/common.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>	
	<script language="javascript" src="<%=contextPath%>/js/func.js"type=""></script>
	<script type="text/javascript" src="<%=contextPath%>/js/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript">
	Ext.onReady(function(){
		var tb = new Ext.Toolbar({
		    renderTo: Ext.get('tbar'),
		    items: [
		        {
		            text: '查询',
		             icon:"<%=contextPath%>/" + "images/query.gif",
		             hidden:<%=session.getAttribute("btn_query_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>,
		             handler:cmt
		        }, {
		            text: '起草',
		            icon:"<%=contextPath%>/" + "images/tishi.png",
		            //hidden:<%=session.getAttribute("btn_add_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>,
		            handler:function() {
		            	toDetail('0')
		            }
		        },
		        {
		            text: '删除',
		            icon:"<%=contextPath%>/" + "images/delete.gif",
		            //hidden:<%=session.getAttribute("btn_delete_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>,
		            hidden: true,
		            handler:deleteIt
		        },'-',
				{
				     text: '清空',
				     icon:"<%=contextPath%>/images/clear.png",
				     handler:resetForm
				}]
		});
	});
	</script>
  </head>
  <body>
 <body>
  <div id ='tbar'></div>
  <br>
		<div id="Layer" style="position:absolute;display:block left:0px; top:35px; width:100%; height:94%; z-index:1000; overflow:auto;">
		<form id="frmM" class="ct" name="frmM" method="POST" action="<%=contextPath%>/queryUser.do">
			<input type="hidden" id="hiddenids" name="hiddenids" value="${hiddenids}"/>
			<input type="hidden" name="searchBean.displayFlag" value="${searchBean.displayFlag}"/>
			<input type="hidden" name="searchBean.con1" id="searchBean.con1" value="${searchBean.con1}" >
			<input type="hidden" name="searchBean.con6" id="searchBean.con6" value="${searchBean.con6}" >
			<input type="hidden" name="searchBean.con19" id="searchBean.con19" value="${searchBean.con19}" >
			<input type="hidden" name="conditionHtml" />
			<table width="100%" id="contab" >
				
				<tr>
					<th >填报时间：</th >
					<td  align="left">
					<input type="text" size="9" readonly="true" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'searchBean.con3\')}'})" name="searchBean.con2" id="searchBean.con2" value=${searchBean.con2 }>
					<img onclick="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'searchBean.con3\')}', el:$dp.$('searchBean.con2')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					
					~
					<input type="text" size="9" readonly="true" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'searchBean.con2\')}'})"  name="searchBean.con3" id="searchBean.con3" value=${searchBean.con3 }>
					<img onclick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'searchBean.con2\')}', el:$dp.$('searchBean.con3')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
					<th >部门：</th >
					<td>
						<s:select list="organList" emptyOption="true" name="searchBean.con4" width="300" listKey="organCode" listValue="organName"/>
			        </td>
				</tr>
			</table>
		<hr>
		<table width="100%" id="listtab">
    		<tr>
    			<th>
	           <!--input name="chkAll" type="checkbox" id="chkAll"
				onclick="javascript:checkAll(this.form, 'id');" value="checkbox" -->
				</th>
				<th class="ct">序号</th>
				<th class="ct" >部门</th>
				<th class="ct" >计划日期</th>
				<th class="ct">计划周</th>
				<th class="ct">填报人</th>
				<th class="ct">填报时间</th>
			</tr>
			<c:forEach items="${list}" var="Tab" varStatus="status">
					<tr ondblclick="javascript:toDetail('<c:out value="${Tab.id}"/>')"s>
						<td >
							<c:set value="${Tab.id}," var="varName" />
							<c:if test='${fn:contains(hiddenids, varName)}'>
								<input type="checkbox" name="id" value="${Tab.id}" checked onClick="getAllIds(this)"/>
							</c:if>
							<c:if test='${fn:contains(hiddenids, varName) == false}'>
								<input type="checkbox" name="id" value="${Tab.id}" onClick="getAllIds(this)"/>
							</c:if>
						</td>
						<td> 
							<a href="#" onClick="javascript:toDetail('<c:out value="${Tab.id}"/>')" >${status.index+1}</a>
					 	</td>
					 	<td>${Tab['organname']}</td>
					 	<td>${Tab['ny']}</td>
					 	<td style="text-align: left">${Tab['weeknum']}</td>
						<td style="text-align: left">${Tab['tbr']}</td>
						<td>${Tab.tbrq}</td>
					</tr>
					<tr height="0" id="tr${Tab.id}" style="display:none"><td></td><td colspan="14"><div id="nr${Tab.id}"></div></td></tr>
					<tr height="0" style="display:none"><td></td><td colspan="14"></td></tr>
				</c:forEach>

				<c:if test="${list == null || fn:length(list) == 0 }">
					<tr>
						<td colspan="12" style="text-align: center">
							无相关记录
						</td>
					</tr>
				</c:if>
		</table>
			<table width="100%" id="tablestyle2">
			<tr>
				<td>
					<hr />
				</td>
			</tr>
			<tr>
				<td>${pageDown}</td>
			</tr>
		</table>
	</form>
		</div>
  </body>
  <script>

		// 查询
		function cmt(){
			document.frmM.action = "<%=contextPath%>/weekplanList!getList.do?page=1&c=c";
			document.frmM.submit();
		}
   
   		// 新建修改进入详细页面
		function toDetail(id){
			//location.href = "<%=contextPath%>/weekplan!initWeekPlanDetail.do?id=" + id;
			parent.addTab("周计划", "<%=contextPath%>/weekplan!initWeekPlanDetail.do?id="+id,id);
    
		}

		// 删除
		function deleteIt()
		{
			if(!isChecked("id")) {
		 		alert("请选择要删除的记录");
		 		return false;
		 	}
		    if(confirm("确定要删除选中的记录吗？")) {
		       	document.frmM.action = "<%=contextPath%>/weekplan!deleteWeekPlan.do?";
				document.frmM.submit();
		    }
		}
		
	</script>
</html>
